﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Cosmetic.Logic;

namespace WebApp.Controls
{
    public partial class SearchBarNew : System.Web.UI.UserControl
    {
        ProductManager pm = new ProductManager();
        private int showCount;

        public int ShowCount
        {
            get { return showCount; }
            set { showCount = value; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            Bind();
        }

        //protected void Button1_Click(object sender, EventArgs e)
        //{
        //    if (this.txtSearchContent.Text.Trim()=="")
        //    {
        //        Page.RegisterStartupScript("openalert","<script>alert('关键字不能为空');</script>");
        //        return;
        //    }
        //    Response.Redirect("~/Product/SearchProductNew.aspx?sear="+this.txtSearchContent.Text.Trim());
        //}

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (this.txtSearchContent.Text.Trim() == "")
            {
                Page.RegisterStartupScript("openalert", "<script>alert('关键字不能为空');</script>");
                return;
            }

            Response.Redirect("~/Product/SearchProductNew.aspx?sear=" + this.txtSearchContent.Text.Trim());
        }

        private void Bind()
        {
           this.Repeater1.DataSource = pm.GetHotKeyWord(showCount);
           this.Repeater1.DataBind();
        }



        
    }
}